// $ANTLR 3.2 Sep 23, 2009 12:02:23 C:\\Projects\\TomesLingo\\trunk\\ANTLR01\\ANTLR01\\Eval.g 2010-02-11 14:46:18

// The variable 'variable' is assigned but its value is never used.
#pragma warning disable 168, 219
// Unreachable code detected.
#pragma warning disable 162


	using System.Collections.Generic;
	using System.Linq;
	using System.Linq.Expressions;
	using ANTLR01;


using System;
using Antlr.Runtime;
using Antlr.Runtime.Tree;using IList 		= System.Collections.IList;
using ArrayList 	= System.Collections.ArrayList;
using Stack 		= Antlr.Runtime.Collections.StackList;


public partial class Eval : TreeParser
{
    public static readonly string[] tokenNames = new string[] 
	{
        "<invalid>", 
		"<EOR>", 
		"<DOWN>", 
		"<UP>", 
		"NEGATE", 
		"CONDITION", 
		"SEPARATOR", 
		"IDENT", 
		"ASSIGN", 
		"WS", 
		"AND", 
		"OR", 
		"EQUALS", 
		"NOTEQUALS", 
		"LT", 
		"LTEQ", 
		"GT", 
		"GTEQ", 
		"PLUS", 
		"MINUS", 
		"MULTIPLY", 
		"DIVIDE", 
		"MODULO", 
		"POWER", 
		"NOT", 
		"NUMBER", 
		"CHAR", 
		"EscapeSequence", 
		"UnicodeEscape", 
		"HexDigit", 
		"'?'", 
		"':'", 
		"'('", 
		"')'"
    };

    public const int LT = 14;
    public const int MODULO = 22;
    public const int LTEQ = 15;
    public const int NUMBER = 25;
    public const int CHAR = 26;
    public const int POWER = 23;
    public const int NEGATE = 4;
    public const int NOTEQUALS = 13;
    public const int CONDITION = 5;
    public const int EQUALS = 12;
    public const int SEPARATOR = 6;
    public const int NOT = 24;
    public const int MINUS = 19;
    public const int GTEQ = 17;
    public const int AND = 10;
    public const int EOF = -1;
    public const int HexDigit = 29;
    public const int T__30 = 30;
    public const int T__31 = 31;
    public const int T__32 = 32;
    public const int WS = 9;
    public const int T__33 = 33;
    public const int MULTIPLY = 20;
    public const int UnicodeEscape = 28;
    public const int OR = 11;
    public const int ASSIGN = 8;
    public const int IDENT = 7;
    public const int GT = 16;
    public const int PLUS = 18;
    public const int EscapeSequence = 27;
    public const int DIVIDE = 21;

    // delegates
    // delegators



        public Eval(ITreeNodeStream input)
    		: this(input, new RecognizerSharedState()) {
        }

        public Eval(ITreeNodeStream input, RecognizerSharedState state)
    		: base(input, state) {
            InitializeCyclicDFAs();

             
        }
        

    override public string[] TokenNames {
		get { return Eval.tokenNames; }
    }

    override public string GrammarFileName {
		get { return "C:\\Projects\\TomesLingo\\trunk\\ANTLR01\\ANTLR01\\Eval.g"; }
    }


    	List<Expression> _expressions = new List<Expression>();
    	ParameterExpression _scope = Expression.Parameter(typeof(SimpleObject), "scope");



    // $ANTLR start "prog"
    // C:\\Projects\\TomesLingo\\trunk\\ANTLR01\\ANTLR01\\Eval.g:21:1: prog returns [Expression<Func<SimpleObject, object>> value] : ( ( stat )* ) ;
    public Expression<Func<SimpleObject, object>> prog() // throws RecognitionException [1]
    {   
        Expression<Func<SimpleObject, object>> value = default(Expression<Func<SimpleObject, object>>);

        try 
    	{
            // C:\\Projects\\TomesLingo\\trunk\\ANTLR01\\ANTLR01\\Eval.g:22:2: ( ( ( stat )* ) )
            // C:\\Projects\\TomesLingo\\trunk\\ANTLR01\\ANTLR01\\Eval.g:22:4: ( ( stat )* )
            {
            	// C:\\Projects\\TomesLingo\\trunk\\ANTLR01\\ANTLR01\\Eval.g:22:4: ( ( stat )* )
            	// C:\\Projects\\TomesLingo\\trunk\\ANTLR01\\ANTLR01\\Eval.g:22:6: ( stat )*
            	{
            		// C:\\Projects\\TomesLingo\\trunk\\ANTLR01\\ANTLR01\\Eval.g:22:6: ( stat )*
            		do 
            		{
            		    int alt1 = 2;
            		    int LA1_0 = input.LA(1);

            		    if ( ((LA1_0 >= NEGATE && LA1_0 <= CONDITION) || (LA1_0 >= IDENT && LA1_0 <= ASSIGN) || (LA1_0 >= AND && LA1_0 <= CHAR)) )
            		    {
            		        alt1 = 1;
            		    }


            		    switch (alt1) 
            			{
            				case 1 :
            				    // C:\\Projects\\TomesLingo\\trunk\\ANTLR01\\ANTLR01\\Eval.g:22:6: stat
            				    {
            				    	PushFollow(FOLLOW_stat_in_prog60);
            				    	stat();
            				    	state.followingStackPointer--;


            				    }
            				    break;

            				default:
            				    goto loop1;
            		    }
            		} while (true);

            		loop1:
            			;	// Stops C# compiler whining that label 'loop1' has no statements


            	}


            				return Expression.Lambda<Func<SimpleObject, object>>(Expression.Block(_expressions), _scope);
            			

            }

        }
        catch (RecognitionException re) 
    	{
            ReportError(re);
            Recover(input,re);
        }
        finally 
    	{
        }
        return value;
    }
    // $ANTLR end "prog"


    // $ANTLR start "stat"
    // C:\\Projects\\TomesLingo\\trunk\\ANTLR01\\ANTLR01\\Eval.g:28:1: stat : ( expr | ^( ASSIGN IDENT expr ) );
    public void stat() // throws RecognitionException [1]
    {   
        CommonTree IDENT2 = null;
        Expression expr1 = default(Expression);

        Expression expr3 = default(Expression);


        try 
    	{
            // C:\\Projects\\TomesLingo\\trunk\\ANTLR01\\ANTLR01\\Eval.g:28:5: ( expr | ^( ASSIGN IDENT expr ) )
            int alt2 = 2;
            int LA2_0 = input.LA(1);

            if ( ((LA2_0 >= NEGATE && LA2_0 <= CONDITION) || LA2_0 == IDENT || (LA2_0 >= AND && LA2_0 <= CHAR)) )
            {
                alt2 = 1;
            }
            else if ( (LA2_0 == ASSIGN) )
            {
                alt2 = 2;
            }
            else 
            {
                NoViableAltException nvae_d2s0 =
                    new NoViableAltException("", 2, 0, input);

                throw nvae_d2s0;
            }
            switch (alt2) 
            {
                case 1 :
                    // C:\\Projects\\TomesLingo\\trunk\\ANTLR01\\ANTLR01\\Eval.g:28:7: expr
                    {
                    	PushFollow(FOLLOW_expr_in_stat76);
                    	expr1 = expr();
                    	state.followingStackPointer--;


                    				_expressions.Add(expr1);
                    			

                    }
                    break;
                case 2 :
                    // C:\\Projects\\TomesLingo\\trunk\\ANTLR01\\ANTLR01\\Eval.g:32:4: ^( ASSIGN IDENT expr )
                    {
                    	Match(input,ASSIGN,FOLLOW_ASSIGN_in_stat86); 

                    	Match(input, Token.DOWN, null); 
                    	IDENT2=(CommonTree)Match(input,IDENT,FOLLOW_IDENT_in_stat88); 
                    	PushFollow(FOLLOW_expr_in_stat90);
                    	expr3 = expr();
                    	state.followingStackPointer--;


                    	Match(input, Token.UP, null); 

                    				_expressions.Add(Expression.Assign(
                    					ExpressionEx.SymbolExpression(_scope, ((IDENT2 != null) ? IDENT2.Text : null)),
                    					expr3
                    				));
                    			

                    }
                    break;

            }
        }
        catch (RecognitionException re) 
    	{
            ReportError(re);
            Recover(input,re);
        }
        finally 
    	{
        }
        return ;
    }
    // $ANTLR end "stat"


    // $ANTLR start "expr"
    // C:\\Projects\\TomesLingo\\trunk\\ANTLR01\\ANTLR01\\Eval.g:41:1: expr returns [Expression value] : ( IDENT | NUMBER | CHAR | ^( CONDITION a= expr b= expr c= expr ) | ^( AND a= expr b= expr ) | ^( OR a= expr b= expr ) | ^( EQUALS a= expr b= expr ) | ^( NOTEQUALS a= expr b= expr ) | ^( LT a= expr b= expr ) | ^( LTEQ a= expr b= expr ) | ^( GT a= expr b= expr ) | ^( GTEQ a= expr b= expr ) | ^( PLUS a= expr b= expr ) | ^( MINUS a= expr b= expr ) | ^( MULTIPLY a= expr b= expr ) | ^( DIVIDE a= expr b= expr ) | ^( MODULO a= expr b= expr ) | ^( POWER a= expr b= expr ) | ^( NEGATE a= expr ) | ^( NOT a= expr ) );
    public Expression expr() // throws RecognitionException [1]
    {   
        Expression value = default(Expression);

        CommonTree IDENT4 = null;
        CommonTree NUMBER5 = null;
        CommonTree CHAR6 = null;
        Expression a = default(Expression);

        Expression b = default(Expression);

        Expression c = default(Expression);


        try 
    	{
            // C:\\Projects\\TomesLingo\\trunk\\ANTLR01\\ANTLR01\\Eval.g:42:2: ( IDENT | NUMBER | CHAR | ^( CONDITION a= expr b= expr c= expr ) | ^( AND a= expr b= expr ) | ^( OR a= expr b= expr ) | ^( EQUALS a= expr b= expr ) | ^( NOTEQUALS a= expr b= expr ) | ^( LT a= expr b= expr ) | ^( LTEQ a= expr b= expr ) | ^( GT a= expr b= expr ) | ^( GTEQ a= expr b= expr ) | ^( PLUS a= expr b= expr ) | ^( MINUS a= expr b= expr ) | ^( MULTIPLY a= expr b= expr ) | ^( DIVIDE a= expr b= expr ) | ^( MODULO a= expr b= expr ) | ^( POWER a= expr b= expr ) | ^( NEGATE a= expr ) | ^( NOT a= expr ) )
            int alt3 = 20;
            switch ( input.LA(1) ) 
            {
            case IDENT:
            	{
                alt3 = 1;
                }
                break;
            case NUMBER:
            	{
                alt3 = 2;
                }
                break;
            case CHAR:
            	{
                alt3 = 3;
                }
                break;
            case CONDITION:
            	{
                alt3 = 4;
                }
                break;
            case AND:
            	{
                alt3 = 5;
                }
                break;
            case OR:
            	{
                alt3 = 6;
                }
                break;
            case EQUALS:
            	{
                alt3 = 7;
                }
                break;
            case NOTEQUALS:
            	{
                alt3 = 8;
                }
                break;
            case LT:
            	{
                alt3 = 9;
                }
                break;
            case LTEQ:
            	{
                alt3 = 10;
                }
                break;
            case GT:
            	{
                alt3 = 11;
                }
                break;
            case GTEQ:
            	{
                alt3 = 12;
                }
                break;
            case PLUS:
            	{
                alt3 = 13;
                }
                break;
            case MINUS:
            	{
                alt3 = 14;
                }
                break;
            case MULTIPLY:
            	{
                alt3 = 15;
                }
                break;
            case DIVIDE:
            	{
                alt3 = 16;
                }
                break;
            case MODULO:
            	{
                alt3 = 17;
                }
                break;
            case POWER:
            	{
                alt3 = 18;
                }
                break;
            case NEGATE:
            	{
                alt3 = 19;
                }
                break;
            case NOT:
            	{
                alt3 = 20;
                }
                break;
            	default:
            	    NoViableAltException nvae_d3s0 =
            	        new NoViableAltException("", 3, 0, input);

            	    throw nvae_d3s0;
            }

            switch (alt3) 
            {
                case 1 :
                    // C:\\Projects\\TomesLingo\\trunk\\ANTLR01\\ANTLR01\\Eval.g:42:4: IDENT
                    {
                    	IDENT4=(CommonTree)Match(input,IDENT,FOLLOW_IDENT_in_expr110); 
                    	 value =  ExpressionEx.SymbolExpression(_scope, ((IDENT4 != null) ? IDENT4.Text : null)); 

                    }
                    break;
                case 2 :
                    // C:\\Projects\\TomesLingo\\trunk\\ANTLR01\\ANTLR01\\Eval.g:43:4: NUMBER
                    {
                    	NUMBER5=(CommonTree)Match(input,NUMBER,FOLLOW_NUMBER_in_expr117); 
                    	 value =  Expression.Constant(Convert.ToDouble(((NUMBER5 != null) ? NUMBER5.Text : null)), typeof(object)); 

                    }
                    break;
                case 3 :
                    // C:\\Projects\\TomesLingo\\trunk\\ANTLR01\\ANTLR01\\Eval.g:44:4: CHAR
                    {
                    	CHAR6=(CommonTree)Match(input,CHAR,FOLLOW_CHAR_in_expr124); 
                    	 value =  Expression.Constant((double)((CHAR6 != null) ? CHAR6.Text : null)[1], typeof(object)); 

                    }
                    break;
                case 4 :
                    // C:\\Projects\\TomesLingo\\trunk\\ANTLR01\\ANTLR01\\Eval.g:45:4: ^( CONDITION a= expr b= expr c= expr )
                    {
                    	Match(input,CONDITION,FOLLOW_CONDITION_in_expr132); 

                    	Match(input, Token.DOWN, null); 
                    	PushFollow(FOLLOW_expr_in_expr138);
                    	a = expr();
                    	state.followingStackPointer--;

                    	PushFollow(FOLLOW_expr_in_expr144);
                    	b = expr();
                    	state.followingStackPointer--;

                    	PushFollow(FOLLOW_expr_in_expr150);
                    	c = expr();
                    	state.followingStackPointer--;


                    	Match(input, Token.UP, null); 
                    	 value =  Expression.Condition(ExpressionEx.ToBoolean(a), b, c); 

                    }
                    break;
                case 5 :
                    // C:\\Projects\\TomesLingo\\trunk\\ANTLR01\\ANTLR01\\Eval.g:46:4: ^( AND a= expr b= expr )
                    {
                    	Match(input,AND,FOLLOW_AND_in_expr159); 

                    	Match(input, Token.DOWN, null); 
                    	PushFollow(FOLLOW_expr_in_expr165);
                    	a = expr();
                    	state.followingStackPointer--;

                    	PushFollow(FOLLOW_expr_in_expr171);
                    	b = expr();
                    	state.followingStackPointer--;


                    	Match(input, Token.UP, null); 
                    	 value =  ExpressionEx.ToDynamicDouble(ExpressionEx.DynamicBinary(ExpressionType.And, ExpressionEx.ToDynamicBoolean(a), ExpressionEx.ToDynamicBoolean(b))); 

                    }
                    break;
                case 6 :
                    // C:\\Projects\\TomesLingo\\trunk\\ANTLR01\\ANTLR01\\Eval.g:47:4: ^( OR a= expr b= expr )
                    {
                    	Match(input,OR,FOLLOW_OR_in_expr180); 

                    	Match(input, Token.DOWN, null); 
                    	PushFollow(FOLLOW_expr_in_expr186);
                    	a = expr();
                    	state.followingStackPointer--;

                    	PushFollow(FOLLOW_expr_in_expr192);
                    	b = expr();
                    	state.followingStackPointer--;


                    	Match(input, Token.UP, null); 
                    	 value =  ExpressionEx.ToDynamicDouble(ExpressionEx.DynamicBinary(ExpressionType.Or, ExpressionEx.ToDynamicBoolean(a), ExpressionEx.ToDynamicBoolean(b))); 

                    }
                    break;
                case 7 :
                    // C:\\Projects\\TomesLingo\\trunk\\ANTLR01\\ANTLR01\\Eval.g:48:4: ^( EQUALS a= expr b= expr )
                    {
                    	Match(input,EQUALS,FOLLOW_EQUALS_in_expr201); 

                    	Match(input, Token.DOWN, null); 
                    	PushFollow(FOLLOW_expr_in_expr207);
                    	a = expr();
                    	state.followingStackPointer--;

                    	PushFollow(FOLLOW_expr_in_expr213);
                    	b = expr();
                    	state.followingStackPointer--;


                    	Match(input, Token.UP, null); 
                    	 value =  ExpressionEx.ToDynamicDouble(ExpressionEx.DynamicBinary(ExpressionType.Equal, a, b)); 

                    }
                    break;
                case 8 :
                    // C:\\Projects\\TomesLingo\\trunk\\ANTLR01\\ANTLR01\\Eval.g:49:4: ^( NOTEQUALS a= expr b= expr )
                    {
                    	Match(input,NOTEQUALS,FOLLOW_NOTEQUALS_in_expr222); 

                    	Match(input, Token.DOWN, null); 
                    	PushFollow(FOLLOW_expr_in_expr228);
                    	a = expr();
                    	state.followingStackPointer--;

                    	PushFollow(FOLLOW_expr_in_expr234);
                    	b = expr();
                    	state.followingStackPointer--;


                    	Match(input, Token.UP, null); 
                    	 value =  ExpressionEx.ToDynamicDouble(ExpressionEx.DynamicBinary(ExpressionType.NotEqual, a, b)); 

                    }
                    break;
                case 9 :
                    // C:\\Projects\\TomesLingo\\trunk\\ANTLR01\\ANTLR01\\Eval.g:50:4: ^( LT a= expr b= expr )
                    {
                    	Match(input,LT,FOLLOW_LT_in_expr243); 

                    	Match(input, Token.DOWN, null); 
                    	PushFollow(FOLLOW_expr_in_expr249);
                    	a = expr();
                    	state.followingStackPointer--;

                    	PushFollow(FOLLOW_expr_in_expr255);
                    	b = expr();
                    	state.followingStackPointer--;


                    	Match(input, Token.UP, null); 
                    	 value =  ExpressionEx.ToDynamicDouble(ExpressionEx.DynamicBinary(ExpressionType.LessThan, a, b)); 

                    }
                    break;
                case 10 :
                    // C:\\Projects\\TomesLingo\\trunk\\ANTLR01\\ANTLR01\\Eval.g:51:4: ^( LTEQ a= expr b= expr )
                    {
                    	Match(input,LTEQ,FOLLOW_LTEQ_in_expr264); 

                    	Match(input, Token.DOWN, null); 
                    	PushFollow(FOLLOW_expr_in_expr270);
                    	a = expr();
                    	state.followingStackPointer--;

                    	PushFollow(FOLLOW_expr_in_expr276);
                    	b = expr();
                    	state.followingStackPointer--;


                    	Match(input, Token.UP, null); 
                    	 value =  ExpressionEx.ToDynamicDouble(ExpressionEx.DynamicBinary(ExpressionType.LessThanOrEqual, a, b)); 

                    }
                    break;
                case 11 :
                    // C:\\Projects\\TomesLingo\\trunk\\ANTLR01\\ANTLR01\\Eval.g:52:4: ^( GT a= expr b= expr )
                    {
                    	Match(input,GT,FOLLOW_GT_in_expr285); 

                    	Match(input, Token.DOWN, null); 
                    	PushFollow(FOLLOW_expr_in_expr291);
                    	a = expr();
                    	state.followingStackPointer--;

                    	PushFollow(FOLLOW_expr_in_expr297);
                    	b = expr();
                    	state.followingStackPointer--;


                    	Match(input, Token.UP, null); 
                    	 value =  ExpressionEx.ToDynamicDouble(ExpressionEx.DynamicBinary(ExpressionType.GreaterThan, a, b)); 

                    }
                    break;
                case 12 :
                    // C:\\Projects\\TomesLingo\\trunk\\ANTLR01\\ANTLR01\\Eval.g:53:4: ^( GTEQ a= expr b= expr )
                    {
                    	Match(input,GTEQ,FOLLOW_GTEQ_in_expr306); 

                    	Match(input, Token.DOWN, null); 
                    	PushFollow(FOLLOW_expr_in_expr312);
                    	a = expr();
                    	state.followingStackPointer--;

                    	PushFollow(FOLLOW_expr_in_expr318);
                    	b = expr();
                    	state.followingStackPointer--;


                    	Match(input, Token.UP, null); 
                    	 value =  ExpressionEx.ToDynamicDouble(ExpressionEx.DynamicBinary(ExpressionType.GreaterThanOrEqual, a, b)); 

                    }
                    break;
                case 13 :
                    // C:\\Projects\\TomesLingo\\trunk\\ANTLR01\\ANTLR01\\Eval.g:54:4: ^( PLUS a= expr b= expr )
                    {
                    	Match(input,PLUS,FOLLOW_PLUS_in_expr327); 

                    	Match(input, Token.DOWN, null); 
                    	PushFollow(FOLLOW_expr_in_expr333);
                    	a = expr();
                    	state.followingStackPointer--;

                    	PushFollow(FOLLOW_expr_in_expr339);
                    	b = expr();
                    	state.followingStackPointer--;


                    	Match(input, Token.UP, null); 
                    	 value =  ExpressionEx.DynamicBinary(ExpressionType.Add, a, b); 

                    }
                    break;
                case 14 :
                    // C:\\Projects\\TomesLingo\\trunk\\ANTLR01\\ANTLR01\\Eval.g:55:4: ^( MINUS a= expr b= expr )
                    {
                    	Match(input,MINUS,FOLLOW_MINUS_in_expr348); 

                    	Match(input, Token.DOWN, null); 
                    	PushFollow(FOLLOW_expr_in_expr354);
                    	a = expr();
                    	state.followingStackPointer--;

                    	PushFollow(FOLLOW_expr_in_expr360);
                    	b = expr();
                    	state.followingStackPointer--;


                    	Match(input, Token.UP, null); 
                    	 value =  ExpressionEx.DynamicBinary(ExpressionType.Subtract, a, b); 

                    }
                    break;
                case 15 :
                    // C:\\Projects\\TomesLingo\\trunk\\ANTLR01\\ANTLR01\\Eval.g:56:4: ^( MULTIPLY a= expr b= expr )
                    {
                    	Match(input,MULTIPLY,FOLLOW_MULTIPLY_in_expr369); 

                    	Match(input, Token.DOWN, null); 
                    	PushFollow(FOLLOW_expr_in_expr375);
                    	a = expr();
                    	state.followingStackPointer--;

                    	PushFollow(FOLLOW_expr_in_expr381);
                    	b = expr();
                    	state.followingStackPointer--;


                    	Match(input, Token.UP, null); 
                    	 value =  ExpressionEx.DynamicBinary(ExpressionType.Multiply, a, b); 

                    }
                    break;
                case 16 :
                    // C:\\Projects\\TomesLingo\\trunk\\ANTLR01\\ANTLR01\\Eval.g:57:4: ^( DIVIDE a= expr b= expr )
                    {
                    	Match(input,DIVIDE,FOLLOW_DIVIDE_in_expr390); 

                    	Match(input, Token.DOWN, null); 
                    	PushFollow(FOLLOW_expr_in_expr396);
                    	a = expr();
                    	state.followingStackPointer--;

                    	PushFollow(FOLLOW_expr_in_expr402);
                    	b = expr();
                    	state.followingStackPointer--;


                    	Match(input, Token.UP, null); 
                    	 value =  ExpressionEx.DynamicBinary(ExpressionType.Divide, a, b); 

                    }
                    break;
                case 17 :
                    // C:\\Projects\\TomesLingo\\trunk\\ANTLR01\\ANTLR01\\Eval.g:58:4: ^( MODULO a= expr b= expr )
                    {
                    	Match(input,MODULO,FOLLOW_MODULO_in_expr411); 

                    	Match(input, Token.DOWN, null); 
                    	PushFollow(FOLLOW_expr_in_expr417);
                    	a = expr();
                    	state.followingStackPointer--;

                    	PushFollow(FOLLOW_expr_in_expr423);
                    	b = expr();
                    	state.followingStackPointer--;


                    	Match(input, Token.UP, null); 
                    	 value =  ExpressionEx.DynamicBinary(ExpressionType.Modulo, a, b); 

                    }
                    break;
                case 18 :
                    // C:\\Projects\\TomesLingo\\trunk\\ANTLR01\\ANTLR01\\Eval.g:59:4: ^( POWER a= expr b= expr )
                    {
                    	Match(input,POWER,FOLLOW_POWER_in_expr432); 

                    	Match(input, Token.DOWN, null); 
                    	PushFollow(FOLLOW_expr_in_expr438);
                    	a = expr();
                    	state.followingStackPointer--;

                    	PushFollow(FOLLOW_expr_in_expr444);
                    	b = expr();
                    	state.followingStackPointer--;


                    	Match(input, Token.UP, null); 
                    	 value =  ExpressionEx.DynamicBinary(ExpressionType.Power, a, b); 

                    }
                    break;
                case 19 :
                    // C:\\Projects\\TomesLingo\\trunk\\ANTLR01\\ANTLR01\\Eval.g:60:4: ^( NEGATE a= expr )
                    {
                    	Match(input,NEGATE,FOLLOW_NEGATE_in_expr453); 

                    	Match(input, Token.DOWN, null); 
                    	PushFollow(FOLLOW_expr_in_expr459);
                    	a = expr();
                    	state.followingStackPointer--;


                    	Match(input, Token.UP, null); 
                    	 value =  ExpressionEx.DynamicUnary(ExpressionType.Negate, a); 

                    }
                    break;
                case 20 :
                    // C:\\Projects\\TomesLingo\\trunk\\ANTLR01\\ANTLR01\\Eval.g:61:4: ^( NOT a= expr )
                    {
                    	Match(input,NOT,FOLLOW_NOT_in_expr468); 

                    	Match(input, Token.DOWN, null); 
                    	PushFollow(FOLLOW_expr_in_expr474);
                    	a = expr();
                    	state.followingStackPointer--;


                    	Match(input, Token.UP, null); 
                    	 value =  ExpressionEx.DynamicUnary(ExpressionType.Not, a); 

                    }
                    break;

            }
        }
        catch (RecognitionException re) 
    	{
            ReportError(re);
            Recover(input,re);
        }
        finally 
    	{
        }
        return value;
    }
    // $ANTLR end "expr"

    // Delegated rules


	private void InitializeCyclicDFAs()
	{
	}

 

    public static readonly BitSet FOLLOW_stat_in_prog60 = new BitSet(new ulong[]{0x0000000007FFFDB2UL});
    public static readonly BitSet FOLLOW_expr_in_stat76 = new BitSet(new ulong[]{0x0000000000000002UL});
    public static readonly BitSet FOLLOW_ASSIGN_in_stat86 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_IDENT_in_stat88 = new BitSet(new ulong[]{0x0000000007FFFCB0UL});
    public static readonly BitSet FOLLOW_expr_in_stat90 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_IDENT_in_expr110 = new BitSet(new ulong[]{0x0000000000000002UL});
    public static readonly BitSet FOLLOW_NUMBER_in_expr117 = new BitSet(new ulong[]{0x0000000000000002UL});
    public static readonly BitSet FOLLOW_CHAR_in_expr124 = new BitSet(new ulong[]{0x0000000000000002UL});
    public static readonly BitSet FOLLOW_CONDITION_in_expr132 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_expr_in_expr138 = new BitSet(new ulong[]{0x0000000007FFFCB0UL});
    public static readonly BitSet FOLLOW_expr_in_expr144 = new BitSet(new ulong[]{0x0000000007FFFCB0UL});
    public static readonly BitSet FOLLOW_expr_in_expr150 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_AND_in_expr159 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_expr_in_expr165 = new BitSet(new ulong[]{0x0000000007FFFCB0UL});
    public static readonly BitSet FOLLOW_expr_in_expr171 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_OR_in_expr180 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_expr_in_expr186 = new BitSet(new ulong[]{0x0000000007FFFCB0UL});
    public static readonly BitSet FOLLOW_expr_in_expr192 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_EQUALS_in_expr201 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_expr_in_expr207 = new BitSet(new ulong[]{0x0000000007FFFCB0UL});
    public static readonly BitSet FOLLOW_expr_in_expr213 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_NOTEQUALS_in_expr222 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_expr_in_expr228 = new BitSet(new ulong[]{0x0000000007FFFCB0UL});
    public static readonly BitSet FOLLOW_expr_in_expr234 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_LT_in_expr243 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_expr_in_expr249 = new BitSet(new ulong[]{0x0000000007FFFCB0UL});
    public static readonly BitSet FOLLOW_expr_in_expr255 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_LTEQ_in_expr264 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_expr_in_expr270 = new BitSet(new ulong[]{0x0000000007FFFCB0UL});
    public static readonly BitSet FOLLOW_expr_in_expr276 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_GT_in_expr285 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_expr_in_expr291 = new BitSet(new ulong[]{0x0000000007FFFCB0UL});
    public static readonly BitSet FOLLOW_expr_in_expr297 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_GTEQ_in_expr306 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_expr_in_expr312 = new BitSet(new ulong[]{0x0000000007FFFCB0UL});
    public static readonly BitSet FOLLOW_expr_in_expr318 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_PLUS_in_expr327 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_expr_in_expr333 = new BitSet(new ulong[]{0x0000000007FFFCB0UL});
    public static readonly BitSet FOLLOW_expr_in_expr339 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_MINUS_in_expr348 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_expr_in_expr354 = new BitSet(new ulong[]{0x0000000007FFFCB0UL});
    public static readonly BitSet FOLLOW_expr_in_expr360 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_MULTIPLY_in_expr369 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_expr_in_expr375 = new BitSet(new ulong[]{0x0000000007FFFCB0UL});
    public static readonly BitSet FOLLOW_expr_in_expr381 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_DIVIDE_in_expr390 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_expr_in_expr396 = new BitSet(new ulong[]{0x0000000007FFFCB0UL});
    public static readonly BitSet FOLLOW_expr_in_expr402 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_MODULO_in_expr411 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_expr_in_expr417 = new BitSet(new ulong[]{0x0000000007FFFCB0UL});
    public static readonly BitSet FOLLOW_expr_in_expr423 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_POWER_in_expr432 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_expr_in_expr438 = new BitSet(new ulong[]{0x0000000007FFFCB0UL});
    public static readonly BitSet FOLLOW_expr_in_expr444 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_NEGATE_in_expr453 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_expr_in_expr459 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_NOT_in_expr468 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_expr_in_expr474 = new BitSet(new ulong[]{0x0000000000000008UL});

}
